/*
 * d=3
 * n=1639
 * m=1332
 * c=1.23
 * maxlen=12
 * minklen=10
 * maxklen=12
 * minchar=46
 * maxchar=122
 * loop=1
 * numiter=1
 * seed=
 */

static int g[] = {
	0, 14469, -354, 1174, 0, -915, -39178, 0, 219236, -7201,
	-38314, 5267, 0, -7960, 0, 19941, 0, -18881, 0, 5196,
	-8125, -423, 0, -310, -6761, -11424, -5504, -98, 46711, 528,
	-3692, -3788, -648, 1156, 9675, 0, 0, -48980, 1042, 19074,
	-3560, 799, -730, 11680, 0, -23603, -8442, -835, 31381, -72,
	0, 1197, -27227, 0, -13154, 5137, 94, 8953, 9389, 7600,
	64743, 0, -28786, 0, 36, -1736, 2688, 677, -62166, 0,
	-3561, 10583, 55453, -602, 695, -22306, -9096, -13598, -1135, -21,
	-9868, 12098, -3554, 8136, 109, -14848, -4551, -12468, -17346, -2479,
	26189, -354, 0, 533, 19601, -2294, -26303, -764, -15654, 0,
	0, 916, -33350, 1560, 4240, 551, -10547, -25399, -8558, 210797,
	0, -14529, 4533, 63266, -4760, 20075, -1589, 36520, 9779, 162429,
	32398, -6, 62, -408, 0, 570, 87929, 0, 0, 38165,
	-119062, -1069, -16120, 929, -5581, 11911, -64046, -1471, -41905, 418,
	-14722, -54514, 335, 569, -445, 243938, 579, 72977, 0, 0,
	17478, 0, 0, -176421, 310, 7726, -17397, 210, 165716, 37908,
	-1390, -9314, -37849, -10250, -26183, -1002, -698, 47624, 0, 0,
	6391, -6170, 46, 14054, 1746, -42512, -43, 0, 0, -4330,
	-7698, 25622, 10599, -5242, -26691, 0, 10363, 10617, 26380, 0,
	0, 24430, 314, 1006, 6810, -15813, -176, 11419, -26528, -23623,
	-1005, 0, -101472, 16244, 33859, 0, -15060, -4504, 4139, 0,
	10161, -885, -10981, 0, 18940, -2218, 3459, 187, 0, 396,
	0, -76, 743, 0, 0, 1132, -19219, -658, 12594, -7940,
	-520, 715, -932, 3954, 0, 538, -3082, 0, 6241, 25362,
	1633, 491, -9628, 0, -1922, 20303, 887, 10013, -27906, -12902,
	352, 36861, 4445, 874, 42247, 23663, 25796, 1144, 394, 28198,
	0, 1597, 1081, 962, 0, 21787, -456, -5604, -8568, -10291,
	164, 16690, -1725, 0, -1149, 247, 3605, 0, 25049, 2084,
	8418, -18936, 10050, 57557, -13727, 63688, 762, 14109, -707, 160634,
	0, -7674, -218373, -7248, 1093, 1086, 0, -803, -6177, 5003,
	631, -9795, 10964, 0, 665, 815, 0, 7615, 3786, -3024,
	-3604, -39723, 1080, -1724, 3572, 33318, -3486, 0, 167467, 28887,
	-15969, 12743, -5741, 1390, 27073, 1060, 2855, 1048, 26264, 13070,
	1173, 0, 49, 65977, 5818, -527, -4128, 0, 0, 21328,
	0, -25652, 27217, 205, 0, -10082, 0, -29754, 47373, -3638,
	0, -7976, 1061, 1426, 29467, 3712, 1477, -49171, 24971, 456,
	356, -36045, 0, 2546, -479, 13978, -9489, 0, 684, 13448,
	0, -5028, -12077, -1666, 0, 0, -14418, -103509, -2307, -315,
	843, 479, 1454, -37843, 979, 826, 29199, -32641, -1899, 70664,
	967, 457, -188, -35872, 0, 0, 15026, 8144, 703, 14682,
	3106, 3727, 2240, 0, -1563, 598, -36556, -6199, 0, 1720,
	44763, 0, -2208, 22525, 434, -35204, -27938, 22, 184, 16822,
	6975, -94, 271, 0, -18979, 10745, -13480, 0, 559, 38782,
	1540, 14498, 0, -10539, 2413, 12917, -2186, -546, 0, -243825,
	11883, 1745, 924, 125, -583, -328, 13544, 0, 40496, 0,
	49168, 80, -9298, 109, 0, 7447, 36819, -766, 4681, 0,
	5812, 798, 0, -3333, -9404, 0, 0, -44518, 10891, -11507,
	279, 4955, 497, -5446, -12545, -5743, 1584, -8618, 10096, -40896,
	0, -10539, 0, -1232, 13237, -2910, -16210, -601, 106308, -159365,
	-983, 12332, -15781, 352, -4385, 0, 2778, 42020, -2060, 99780,
	6838, -4017, 8301, 892, -27706, -7161, 0, -683, -16121, -14129,
	-9330, 3622, 2404, -379, -26988, -202606, -14294, 6419, 1414, 0,
	0, 251, 1785, 15498, -16653, 175, -3280, 955, 25370, 0,
	-59038, -2808, 243121, -2366, -87259, -810, 6703, -1229, 0, 12725,
	-1022, 527, -31541, -1045, 0, -17671, -3141, 7136, 0, -187,
	35, -21383, -3951, 17994, 8596, 193, 0, 0, -44559, 26186,
	27087, 10823, -13602, -3940, -165626, 7, -3765, 869, -235, 5712,
	0, 12574, -13647, -1109, -2240, 32928, 37451, -23672, 0, 3869,
	-2767, -8228, 0, 1570, 0, -1392, 0, -87701, -3165, 53964,
	24967, 1880, 0, 0, 33630, -24991, -7247, -1523, 9235, 19868,
	213, -692, 5313, 0, 742, 19577, 0, -2007, -30420, 643,
	-1231, 0, -1542, 0, -9589, 3696, -28165, 999, 0, 924,
	-8273, 1175, 0, 2218, -1296, -1206, 31015, 0, 838, 8970,
	-5862, 249, 2546, -4647, -1924, -46120, 2474, 13460, -7035, 69600,
	589, 0, -45836, 0, 0, 112, 0, -378, 997, -36993,
	31289, -6419, -12701, 0, 0, -30508, 0, 21096, -866, -5850,
	23, -10413, 5074, -8198, 244695, -3452, 0, -4267, 0, -26185,
	1758, -9456, 0, 15056, 21353, 0, 1029, 73472, -29896, -9998,
	329, 0, -12823, 0, -8310, -1000, -7160, -647, 0, 0,
	2604, -557, 0, -6659, 0, 0, 0, -9926, -6351, -4069,
	0, 25299, -604, 0, -58292, 0, 741, -25407, -450, -18405,
	-432, -853, -37, 11, 13927, 5792, 19910, 0, -17856, -2180,
	-5406, -6390, -12320, -4275, -14044, 13640, 0, 0, 0, 6818,
	8329, -8263, 0, 3085, -156435, -5297, 17976, -1599, 55144, -3961,
	28885, 1434, 0, 205, -34435, -380, -11217, -3000, -17738, 9522,
	10118, 3, -5121, 0, 0, 11079, 0, 10830, -36012, 44556,
	40, -13259, -14179, 697, -6227, 0, 0, -318, 0, 0,
	-639, 2140, 3980, 13587, -26294, -204148, 917, 0, 0, 12022,
	-7534, 591, 32856, 0, -12975, 26078, 3699, 60581, -688, 34599,
	16107, 0, 1384, 0, 112810, -495, 8160, -2282, 20112, 0,
	0, 0, 0, -26553, -138666, -223696, -6857, -8394, 39272, -32666,
	3900, 0, 0, -2, -43381, -40858, -4839, 0, 30032, -20427,
	0, 4845, 9532, 13770, -7954, 4515, 12547, 447, 10198, 30812,
	129642, 465, -330, 0, -29253, 25316, 30509, 224, 13794, -32620,
	-8613, -31310, 8535, -19656, -65439, -13479, 1021, 0, 0, 12784,
	-4611, 8336, 932, 27849, 33701, 0, 0, 508, -2321, 0,
	-347, -9207, -8346, 4701, -64665, -6474, -6795, 147, -19526, 6498,
	1499, -163789, 0, -5730, 4893, 0, -108, 3223, -175187, 0,
	-580, 0, 0, 16838, 0, 173, -2408, 10347, -24129, -26462,
	672, 471, 121, 8815, 0, 1230, 706, -7560, 0, 0,
	-3990, -207, 344, -11886, 10671, -53937, 31059, 9777, 65364, -252,
	-5896, -4188, -8423, 963, -3520, -10118, -72993, -12576, -599, 9509,
	0, 26769, 3208, 1793, 22569, 2742, -46446, 47, 0, 0,
	0, 75, -3072, 295, -250, -1678, 751, 117819, -13893, 23546,
	0, 0, 1363, 5839, 781, 15966, 0, -728, 16323, 3004,
	-65342, -3394, 8597, 0, -555, 329, 0, 544, -6280, 15555,
	13041, 11463, 9728, 276, -6844, -32466, 0, -3609, 26231, -167213,
	9677, 0, 14304, 8254, 53618, 0, 2451, 0, -50816, 32331,
	0, 27839, -4972, 374, -1149, 0, 54677, -43000, -48097, -11365,
	7463, 3545, -5124, -12224, 5522, 105907, 3492, 1013, 26902, -3359,
	-27460, 0, 270, -4881, 3347, -2794, 28152, 3566, 0, -51494,
	-27661, -65025, 6923, -12285, 12064, 0, 0, 3147, -81, -27878,
	10997, -2577, -39, 200908, -2389, 6122, 0, 0, 0, -2252,
	-1467, 40317, 506, 41634, 26958, 5, 0, -11170, -601, 4862,
	16160, 7793, -9104, -7147, -29971, -58560, 4350, -4932, -12683, 0,
	-11899, -28340, -548, 13528, -1194, -258, 0, -13218, 7563, 0,
	28102, 0, 1109, -27913, 666, -15579, 38101, -740, 1364, -9695,
	6665, 10701, -25283, -16211, 0, 0, 0, 5360, 0, 786,
	204, 1079, 7085, -1530, -37892, 37616, 0, 521, -5147, 2561,
	0, -5032, 9908, -18761, 0, 21220, 15232, -7619, 62, -2103,
	1287, -27907, -106, -6809, 0, 66523, 176881, -1730, -44925, 9151,
	11027, -5674, 0, 0, 0, 1745, 1177, -1734, 6071, -8492,
	451, -1440, 3051, -16623, 12609, -3943, 14602, 44514, 0, -48,
	-4492, 789, 45497, 13209, -8305, 13311, 36459, 14826, 0, 532,
	-889, 0, -15225, 0, 5094, -11026, 17841, -4217, -161935, 993,
	18701, 0, 728, 1092, 0, 0, 9333, 6913, -35952, 6672,
	412, -8651, -889, 13924, 605, -8931, -969, -52024, -11848, 510,
	117384, -306, 777, 0, 11064, 14006, 0, 1632, 0, -34029,
	0, -188, 0, -219216, 0, 766, 0, 1595, 586, 18074,
	-1173, 14285, 1113, 0, 9801, -47316, 24869, -633, 167205, 19049,
	1018, 19196, 11997, 12632, -7234, -886, 0, 1255, 27042, -24288,
	1057, 0, 77, 6504, 4924, -1311, -6592, -47872, 0, 3675,
	43675, 0, -7970, 17841, -413, 90409, 0, -526, 0, 4042,
	-7733, -854, 13870, 0, 1877, 0, 0, 0, -8800, -15132,
	-2558, 703, 0, 9245, -574, 572, -9509, 0, 2382, -1712,
	13197, -19831, 0, 1558, -11424, 10035, -1996, -11469, 30246, 8446,
	48822, 924, 2007, -198917, -669, -25203, 0, 10046, 1091, -55737,
	-11781, 950, 9612, -36235, 2204, 20099, 14459, 945, 0, 1238,
	-34638, 1427, -312, -109210, 11628, 0, -50192, -386, -1742, 12816,
	7656, 0, 659, 9480, 0, -164716, 35, 46036, -1193, -3067,
	319, 0, 0, 18720, 970, 8123, -687, -27677, -631, -30987,
	-9595, 0, -34692, 624, 648, 0, 11415, 0, 11909, 1638,
	0, 2609, 26267, -13684, -780, 2059, 1090, 11404, -10414, 1428,
	0, 0, 19885, 0, 0, 143, 18203, -15449, 507, 0,
	0, -2044, 1383, -17640, -3574, 0, -11131, 1304, -30460, -1378,
	-7948, 5190, -990, 0, 26019, 22275, -44680, 17263, 2752, 17883,
	-17255, -1792, 20283, 1072, 561, 4, 44379, 816, -1300, 6033,
	377, -28292, 12667, 8528, 0, 0, 0, 1113, 193061, 5643,
	-14588, 0, 7188, 1674, -12836, 966, -25181, 19334, 9459, 109979,
	0, 9207, 0, 20338, -1423, 334, -332, 164167, 40566, 1114,
	1357, 8415, 7981, -10413, -1722, -9941, 26616, -15725, 0, 0,
	-12608, 1890, 68602, 367, 6721, 8287, 3868, -13720, 162083, 67578,
	-498, 0, -9560, 26917, -9152, 0, 0, 42430, 0, -112,
	0, -11934, -16, 1188, 19624, 25292, 39077, -14098, 46841, -431,
	8244, -7434, -2517, -79165, 350, -1036, 1178, 6927, 708, -12581,
	464, 19103, 307, 6751, 4287, -12425, -1570, 6745, 9769, -39779,
	0, -33275, -16811, -12763, 608, -16316, 22159, 2686, -25694, -947,
	13775, -51649, 0, 5970, 2666, -3572, 1620, -55530, -40, 355,
	-1936, -4556, 375, -32116, -444, 4224, 0, 232, 1661, 0,
	0, 207196, 657, 29248, 1085, 550, 0, 0, -90145, -11071,
	0, 8800, 19601, 42, 1053, 54000, -16835, 35409, -28556, 0,
	0, 14211, -199, -44265, 367, 1592, -291, 0, 0, -6236,
	5460, 27407, 228, 352, 4507, -26932, 8201, 0, 31589, 28907,
	-1046, 157, 3142, -25592, 0, -7809, -69395, 195, -9546, -106531,
	0, 42708, -3394, -5512, 1869, -14731, -1213, 13922, 660, -8916,
	0, -3451, 0, 19835, -63881, 399, 0, -20737, 1658, 0,
	-1215, 0, -6231, 0, -541, 0, -1840, 11002, 494, 460,
	-841, 6639, 772, 0, -30805, -9437, 2034, -3783, 1955, 2354,
	2167, 47080, -1017, -13816, -37750, 0, -6042, -651, 1012, 0,
	221, 15054, 0, 0, 618, 1098, 0, 0, -68459, 417,
	-35, 34, 0, 14167, 0, 51364, -6722, 7181, -30010, -26466,
	0, -7240, 8041, 545, 0, -38599, 54629, -150, 0, -32281,
	1770, -8581, -432, 22235, -11883, -11341, 1737, -12947, -1305, 8165,
	-401, 133, 0, -14252, 7759, 0, 0, 3548, 0, 
};

static int T0[] = {
	191, 669, 271, 776, 393, 1359, 497, 926, 854, 886,
	1381, 5, 335, 1151, 1588, 1368, 433, 476, 292, 1120,
	417, 717, 697, 815, 176, 1121, 592, 1192, 638, 1187,
	1046, 541, 1568, 1318, 1030, 34, 1038, 1527, 960, 1604,
	486, 703, 1609, 821, 215, 1559, 262, 360, 108, 554,
	1193, 526, 984, 251, 1053, 872, 1372, 7, 137, 84,
	906, 1184, 337, 547, 863, 1079, 582, 1613, 679, 1254,
	1579, 1165, 30, 1549, 59, 1597, 1181, 1226, 584, 304,
	1306, 695, 685, 145, 1178, 1275, 210, 837, 1161, 254,
	127, 1001, 1049, 679, 1177, 522, 85, 1047, 280, 189,
	213, 944, 625, 296, 1070, 152, 745, 585, 1090, 1041,
	601, 470, 97, 1286, 327, 987, 635, 249, 186, 157,
	503, 25, 870, 1553, 704, 409, 148, 501, 1456, 428,
	403, 30, 1373, 1028, 38, 516, 893, 783, 813, 56,
	1536, 1415, 526, 1634, 774, 853, 694, 1409, 815, 880,
	1567, 1318, 617, 798, 1637, 279, 1569, 1487, 562, 148,
	888, 1372, 1139, 0, 187, 1581, 906, 1637, 1294, 1537,
	927, 1397, 1482, 761, 1109, 1004, 470, 875, 583, 139,
	1255, 206, 1326, 950, 1420, 1325, 1230, 1350, 1173, 153,
	1210, 134, 1237, 711, 134, 1136, 365, 1041, 1134, 1371,
	651, 423, 1129, 206, 896, 311, 1210, 1366, 898, 1505,
	1217, 226, 1424, 616, 1177, 1205, 302, 480, 628, 1187,
	345, 199, 1034, 1294, 622, 1168, 791, 988, 282, 287,
	432, 1460, 1043, 46, 732, 351, 1371, 971, 1415, 1552,
	1247, 1170, 85, 636, 254, 1346, 781, 1480, 612, 1615,
	285, 1590, 777, 1429, 506, 205, 1268, 1258, 939, 1628,
	903, 678, 1161, 19, 725, 1606, 371, 169, 938, 147,
	82, 547, 1318, 1518, 895, 1284, 1225, 37, 837, 198,
	1364, 1122, 150, 215, 624, 656, 420, 253, 1626, 1360,
	1593, 891, 111, 1116, 910, 836, 1083, 1281, 1005, 94,
	1141, 799, 353, 532, 678, 1249, 1528, 265, 1307, 253,
	479, 1076, 1460, 1439, 973, 11, 356, 756, 1342, 930,
	1242, 1059, 1217, 1421, 281, 280, 103, 748, 776, 593,
	1237, 119, 1159, 1491, 8, 661, 424, 1580, 587, 1443,
	1546, 1066, 593, 1367, 578, 1278, 1090, 934, 107, 505,
	225, 1061, 1276, 1442, 844, 1557, 1434, 947, 379, 572,
	1540, 1616, 403, 772, 1180, 411, 1145, 1316, 64, 93,
	1121, 1610, 871, 75, 1050, 1449, 1065, 214, 456, 1173,
	719, 682, 595, 69, 197, 7, 576, 811, 193, 1571,
	92, 1070, 1128, 584, 1150, 945, 1498, 667, 1397, 1122,
	353, 525, 24, 1627, 1479, 1209, 1464, 546, 1240, 933,
	1467, 137, 200, 412, 1258, 941, 131, 195, 1465, 325,
	128, 1557, 1395, 1256, 214, 618, 275, 74, 997, 33,
	908, 1350, 270, 644, 1050, 111, 215, 876, 369, 1455,
	1521, 198, 1593, 82, 322, 1212, 736, 166, 1407, 562,
	491, 1247, 480, 1598, 865, 407, 289, 1140, 481, 1287,
	885, 1101, 210, 1124, 339, 965, 170, 470, 382, 60,
	967, 1463, 698, 172, 86, 1560, 444, 831, 276, 1544,
	391, 1048, 232, 938, 184, 579, 1323, 496, 1354, 248,
	301, 848, 884, 512, 333, 1223, 1477, 503, 54, 1571,
	275, 733, 1395, 685, 906, 1482, 606, 1062, 674, 882,
	679, 1065, 3, 911, 364, 1539, 1203, 1399, 108, 630,
	1359, 409, 1478, 604, 633, 172, 188, 183, 387, 242,
	116, 374, 976, 1511, 1060, 1594, 1354, 27, 729, 1318,
	1591, 140, 426, 973, 201, 426, 205, 1251, 1310, 1108,
	648, 341, 142, 636, 503, 928, 1348, 188, 980, 940,
	932, 292, 1058, 47, 667, 592, 630, 1499, 1519, 752,
	1179, 1471, 893, 1317, 806, 1094, 104, 723, 418, 1126,
	1543, 1066, 1467, 46, 1415, 43, 687, 1124, 231, 28,
	137, 875, 320, 908, 923, 700, 1212, 1265, 560, 1092,
	90, 1451, 925, 695, 1129, 1443, 1502, 1233, 527, 281,
	721, 144, 1060, 261, 190, 836, 1313, 1407, 378, 1515,
	715, 441, 1275, 1118, 812, 1490, 801, 1580, 1154, 17,
	228, 62, 51, 302, 1392, 1545, 995, 812, 251, 388,
	148, 1052, 219, 567, 1150, 356, 814, 825, 1475, 904,
	413, 551, 1345, 1401, 30, 230, 1252, 543, 172, 480,
	560, 112, 542, 323, 414, 295, 1581, 1409, 820, 193,
	158, 680, 1245, 377, 1247, 757, 445, 422, 1294, 281,
	1038, 1419, 544, 456, 1181, 287, 687, 507, 830, 571,
	987, 1103, 683, 39, 748, 877, 1102, 466, 1015, 162,
	988, 1505, 1277, 1192, 1258, 428, 1572, 1302, 1110, 937,
	67, 261, 1347, 1419, 1319, 408, 1224, 477, 119, 1510,
	316, 1370, 562, 1027, 1121, 1310, 265, 584, 1488, 993,
	459, 549, 859, 97, 103, 190, 237, 1387, 1204, 1348,
	397, 1272, 1321, 105, 1052, 1001, 226, 637, 1479, 345,
	508, 1507, 1427, 782, 895, 909, 454, 872, 1494, 15,
	226, 26, 565, 797, 1474, 380, 988, 72, 128, 265,
	949, 148, 441, 1371, 1554, 1568, 1125, 1438, 447, 431,
	1213, 759, 346, 1162, 642, 271, 906, 1215, 258, 527,
	759, 1469, 365, 1404, 1497, 1585, 897, 1125, 363, 718,
	173, 1024, 578, 327, 468, 205, 1607, 1593, 5, 127,
	385, 1218, 886, 443, 453, 1240, 715, 1359, 817, 685,
	248, 1288, 515, 613, 1054, 85, 271, 24, 1211, 346,
	742, 1096, 1082, 1032, 1423, 1551, 1238, 1391, 1505, 955,
	1519, 1603, 534, 478, 119, 987, 80, 1327, 959, 1188,
	745, 961, 1561, 651, 1510, 1370, 686, 1041, 439, 876,
	1079, 289, 423, 1525, 330, 43, 829, 1179, 309, 579,
	231, 1276, 538, 477, 1266, 52, 936, 646, 1091, 256,
	196, 197, 1217, 1469, 560, 801, 912, 1246, 203, 1351,
	483, 994, 1352, 619, 881, 43, 662, 71, 934, 683,
	650, 878, 32, 900, 1355, 1299, 664, 652, 306, 1467,
	909, 214, 1376, 199, 44, 297, 1000, 956, 1544, 916,
	380, 100, 271, 93, 
};

static int T1[] = {
	134, 1515, 796, 1153, 1476, 1463, 1421, 1328, 528, 636,
	1594, 327, 522, 463, 1056, 262, 1054, 1289, 1445, 790,
	1630, 842, 843, 1147, 315, 339, 1422, 1065, 1450, 1488,
	577, 1296, 1364, 1373, 810, 913, 1197, 592, 314, 1438,
	940, 269, 126, 1462, 732, 894, 1436, 1498, 544, 955,
	361, 247, 1509, 916, 1395, 186, 967, 890, 963, 778,
	739, 1540, 435, 176, 1274, 957, 1089, 545, 1261, 1403,
	56, 275, 1384, 1533, 1449, 189, 789, 815, 1042, 1558,
	1452, 137, 46, 1515, 664, 1374, 1245, 65, 267, 395,
	236, 946, 938, 985, 1627, 935, 1537, 994, 1108, 1117,
	86, 100, 554, 946, 821, 353, 94, 1506, 1168, 848,
	1425, 694, 986, 1471, 570, 1362, 1206, 176, 1140, 1186,
	284, 1376, 205, 934, 722, 193, 230, 333, 1187, 1051,
	1162, 985, 863, 78, 293, 46, 431, 99, 1552, 1311,
	659, 1050, 366, 6, 595, 936, 1081, 1513, 825, 582,
	1060, 821, 319, 1265, 29, 903, 1591, 1217, 1588, 571,
	105, 479, 1324, 588, 70, 1486, 228, 833, 1150, 1463,
	795, 736, 1491, 243, 1138, 438, 730, 1199, 350, 232,
	297, 957, 272, 1403, 1126, 301, 667, 790, 1230, 329,
	1074, 1336, 808, 471, 1636, 591, 318, 1577, 1424, 1180,
	1401, 580, 277, 965, 535, 1127, 1404, 977, 687, 1466,
	922, 985, 497, 1194, 461, 1623, 1207, 841, 486, 798,
	1170, 1560, 207, 339, 392, 1556, 930, 422, 1494, 427,
	1602, 813, 284, 890, 873, 1326, 1635, 541, 541, 325,
	1124, 1055, 1372, 1208, 132, 513, 1119, 591, 1628, 1175,
	421, 860, 1422, 123, 1486, 129, 1479, 1579, 307, 1574,
	287, 10, 460, 283, 900, 1045, 1609, 608, 1586, 223,
	934, 784, 1278, 667, 65, 1123, 892, 1185, 1426, 593,
	433, 208, 1453, 216, 44, 1012, 346, 1523, 665, 365,
	1170, 952, 376, 1630, 1235, 988, 1037, 1205, 1597, 696,
	1428, 604, 1480, 779, 1271, 1546, 263, 236, 1162, 1566,
	535, 1205, 1612, 1582, 1216, 503, 997, 466, 1162, 1075,
	1186, 366, 780, 1594, 1133, 1562, 696, 1614, 1621, 681,
	42, 1271, 1188, 888, 1335, 554, 1088, 575, 643, 323,
	503, 1178, 1529, 188, 833, 818, 691, 191, 1284, 1565,
	1267, 831, 5, 120, 498, 1138, 1394, 1195, 825, 1377,
	1588, 867, 721, 1137, 1467, 129, 1404, 629, 417, 408,
	952, 920, 1298, 554, 820, 205, 1372, 1223, 396, 1017,
	1150, 1375, 1561, 867, 1208, 1378, 1374, 1196, 512, 1326,
	338, 1480, 551, 1201, 993, 901, 1021, 830, 1043, 1293,
	361, 435, 580, 174, 85, 336, 164, 18, 1575, 599,
	1121, 1537, 1130, 1336, 548, 1159, 787, 1635, 717, 1299,
	1322, 767, 1140, 1586, 41, 495, 848, 1062, 1037, 1603,
	429, 1398, 400, 721, 1284, 485, 1057, 1161, 215, 994,
	1472, 1048, 604, 963, 745, 865, 484, 1532, 861, 913,
	905, 256, 1392, 406, 203, 1434, 613, 1052, 569, 12,
	1016, 998, 1556, 1589, 1488, 1579, 1401, 717, 309, 1327,
	1296, 559, 1619, 1412, 905, 1556, 261, 1400, 268, 56,
	1120, 778, 201, 1448, 1139, 857, 1476, 517, 625, 834,
	452, 304, 216, 370, 1605, 65, 22, 1367, 783, 43,
	767, 440, 602, 748, 213, 1219, 377, 186, 692, 645,
	243, 1524, 1135, 156, 1045, 636, 725, 883, 865, 1350,
	1429, 1317, 15, 6, 48, 1620, 72, 1421, 1060, 567,
	1464, 189, 719, 139, 649, 644, 1071, 1026, 831, 510,
	136, 76, 1374, 434, 459, 468, 15, 562, 1040, 281,
	840, 450, 349, 1290, 1528, 1289, 1405, 802, 911, 475,
	40, 884, 360, 526, 1325, 438, 1359, 1114, 1395, 1119,
	1624, 1532, 1195, 1072, 327, 15, 1252, 54, 289, 365,
	48, 1130, 528, 109, 781, 417, 1398, 259, 931, 670,
	447, 971, 1267, 807, 1210, 953, 957, 930, 140, 714,
	410, 1476, 319, 1317, 909, 358, 1045, 235, 412, 1334,
	600, 172, 537, 840, 281, 1030, 114, 1397, 444, 1170,
	842, 577, 486, 167, 433, 692, 1437, 813, 121, 95,
	1129, 127, 1638, 1298, 1608, 1078, 537, 189, 1572, 604,
	476, 1622, 447, 615, 762, 1248, 177, 588, 718, 333,
	1470, 1560, 622, 29, 89, 1056, 721, 1526, 1581, 555,
	1333, 1071, 682, 1332, 443, 363, 483, 980, 553, 128,
	1296, 741, 111, 104, 1068, 585, 1064, 1245, 1173, 143,
	1290, 1004, 65, 273, 1034, 1505, 1041, 116, 1104, 984,
	383, 798, 128, 1176, 113, 242, 49, 1449, 73, 25,
	330, 280, 677, 823, 515, 1136, 378, 875, 519, 636,
	608, 1610, 36, 659, 55, 539, 703, 1242, 34, 159,
	1497, 1204, 766, 473, 453, 879, 715, 503, 402, 500,
	240, 444, 780, 629, 1268, 1295, 1477, 7, 243, 357,
	356, 564, 328, 104, 1223, 95, 643, 1638, 1050, 677,
	159, 908, 1593, 925, 1093, 408, 1517, 1520, 623, 280,
	382, 863, 724, 1162, 1492, 353, 531, 1043, 73, 774,
	1141, 1600, 1620, 893, 277, 924, 255, 90, 841, 1201,
	942, 1147, 716, 620, 900, 914, 979, 1624, 784, 340,
	441, 827, 1577, 74, 1103, 1342, 1452, 487, 143, 408,
	1606, 996, 81, 1299, 1601, 359, 584, 217, 161, 1137,
	1131, 1103, 646, 208, 84, 1258, 834, 775, 1243, 1619,
	1116, 1396, 807, 766, 1182, 1623, 181, 707, 471, 36,
	1115, 151, 1032, 909, 1162, 706, 980, 108, 924, 1141,
	957, 128, 606, 1315, 48, 402, 934, 891, 84, 1137,
	577, 1595, 838, 905, 365, 759, 158, 902, 63, 405,
	198, 455, 575, 469, 283, 1556, 973, 1062, 1581, 223,
	1161, 554, 1144, 288, 701, 510, 683, 347, 1401, 479,
	1196, 51, 436, 395, 956, 801, 867, 1115, 1415, 642,
	1232, 1326, 809, 168, 156, 1092, 85, 841, 228, 1378,
	1064, 1389, 6, 569, 1389, 419, 791, 433, 766, 265,
	625, 323, 316, 1061, 430, 1272, 223, 1297, 460, 1351,
	12, 53, 1038, 821, 
};

static int T2[] = {
	378, 84, 137, 1364, 466, 488, 250, 1290, 780, 755,
	353, 610, 832, 143, 1252, 346, 1427, 545, 1511, 1167,
	516, 1595, 934, 93, 260, 114, 441, 568, 560, 453,
	947, 939, 250, 796, 664, 428, 1284, 626, 1430, 137,
	1381, 144, 747, 287, 288, 73, 633, 76, 618, 218,
	955, 846, 174, 250, 651, 146, 77, 1092, 714, 637,
	1258, 1374, 1576, 1508, 243, 314, 9, 1240, 940, 1439,
	1377, 395, 1583, 198, 394, 232, 271, 468, 1441, 63,
	1637, 283, 1031, 82, 129, 662, 511, 152, 69, 1097,
	1213, 0, 1620, 603, 496, 843, 1397, 1602, 358, 210,
	770, 411, 162, 253, 738, 450, 490, 328, 631, 292,
	392, 629, 287, 1423, 424, 416, 159, 647, 280, 228,
	106, 1493, 1579, 87, 170, 436, 642, 1567, 112, 1000,
	139, 882, 1124, 13, 1135, 223, 176, 1337, 264, 807,
	1629, 368, 1148, 1628, 1503, 1572, 405, 23, 581, 398,
	1602, 687, 1603, 1542, 1378, 512, 318, 1471, 813, 648,
	412, 1218, 276, 819, 719, 602, 1456, 1400, 736, 347,
	980, 753, 258, 180, 1477, 256, 1129, 182, 516, 900,
	674, 1561, 1180, 1568, 772, 631, 441, 802, 464, 966,
	1163, 588, 546, 1439, 1119, 977, 402, 937, 738, 850,
	1284, 1430, 1603, 1542, 1610, 1153, 159, 812, 1048, 675,
	73, 83, 310, 1254, 12, 794, 1597, 166, 1596, 422,
	1132, 1120, 723, 1390, 632, 203, 728, 747, 852, 1179,
	1597, 1355, 869, 1120, 355, 91, 431, 708, 5, 1357,
	287, 444, 1178, 639, 736, 1227, 504, 727, 594, 1299,
	341, 1133, 1417, 1496, 1617, 1500, 1333, 1056, 707, 1493,
	986, 400, 1209, 216, 1232, 1276, 307, 1375, 345, 24,
	1093, 633, 468, 345, 1272, 916, 1572, 1488, 1356, 528,
	860, 58, 1373, 638, 1266, 1063, 212, 961, 481, 919,
	527, 1467, 1031, 97, 1396, 624, 1373, 64, 361, 1431,
	1440, 1454, 425, 269, 1511, 1409, 898, 1445, 21, 975,
	450, 1266, 934, 1394, 1236, 654, 1430, 1234, 1498, 12,
	839, 167, 105, 1576, 96, 1329, 623, 1401, 387, 1304,
	660, 904, 573, 1063, 794, 903, 1294, 1474, 983, 1028,
	810, 1146, 367, 1456, 613, 1603, 472, 404, 911, 331,
	417, 111, 210, 234, 1400, 306, 1275, 96, 69, 1374,
	1113, 441, 351, 47, 1217, 1145, 950, 584, 693, 6,
	1612, 1215, 864, 341, 1033, 1477, 17, 1505, 243, 928,
	1548, 372, 752, 1471, 318, 462, 328, 1300, 1584, 1073,
	177, 29, 285, 1614, 1131, 438, 1090, 1638, 397, 1300,
	339, 552, 1408, 411, 1145, 1392, 1423, 424, 1580, 416,
	1527, 1490, 99, 1462, 1163, 1276, 285, 1491, 649, 231,
	637, 827, 260, 922, 514, 1391, 1360, 1316, 1103, 1470,
	977, 1154, 95, 458, 1565, 1240, 1562, 1349, 1376, 1216,
	1478, 1264, 1067, 1577, 1088, 303, 926, 1085, 155, 1576,
	1316, 793, 476, 1289, 76, 702, 753, 1149, 379, 1568,
	692, 1356, 422, 1286, 407, 155, 1396, 869, 1357, 295,
	1448, 153, 1502, 527, 1077, 424, 1259, 1563, 1253, 1604,
	398, 1576, 535, 1052, 120, 17, 1297, 737, 670, 602,
	512, 1111, 283, 934, 758, 690, 1089, 227, 1271, 520,
	235, 1080, 673, 98, 1319, 1462, 523, 940, 1099, 1488,
	617, 1497, 1137, 1152, 622, 1257, 881, 1632, 67, 1551,
	307, 579, 1024, 590, 1226, 1494, 992, 388, 83, 624,
	620, 318, 1416, 1006, 128, 1097, 541, 363, 110, 119,
	559, 525, 1192, 1220, 723, 737, 1200, 156, 476, 736,
	57, 134, 1111, 1348, 1286, 1064, 313, 301, 1099, 857,
	1091, 896, 83, 1124, 917, 1413, 1151, 1227, 1289, 277,
	1346, 1561, 514, 611, 854, 1237, 1348, 127, 1394, 1537,
	575, 1163, 1383, 48, 873, 1030, 824, 898, 1332, 284,
	1468, 784, 1180, 1551, 1620, 458, 1037, 844, 46, 400,
	1121, 1105, 322, 1635, 77, 888, 946, 1138, 1015, 701,
	748, 1303, 1576, 492, 1351, 810, 344, 943, 843, 1531,
	193, 1633, 582, 301, 742, 533, 668, 523, 874, 788,
	1598, 1455, 1577, 358, 1475, 942, 44, 1257, 824, 960,
	1261, 1130, 162, 379, 770, 503, 1571, 826, 1158, 775,
	430, 1352, 481, 1012, 1365, 1224, 1258, 394, 108, 493,
	895, 68, 21, 545, 138, 1497, 1488, 182, 827, 385,
	1143, 449, 1516, 1017, 540, 359, 1232, 472, 897, 752,
	959, 1327, 177, 1440, 700, 1542, 737, 31, 9, 846,
	237, 904, 626, 1141, 605, 1367, 761, 406, 1365, 794,
	1614, 1307, 1405, 703, 1415, 102, 342, 1145, 443, 1434,
	774, 910, 641, 1240, 565, 640, 1123, 744, 1196, 944,
	1409, 1305, 1048, 850, 519, 1365, 578, 992, 132, 16,
	147, 1459, 1324, 1265, 523, 1100, 1367, 577, 318, 1523,
	85, 804, 794, 726, 118, 1359, 1078, 1241, 176, 347,
	258, 1585, 14, 1306, 796, 533, 1032, 1086, 1526, 877,
	1103, 34, 697, 788, 1011, 932, 1600, 452, 1221, 279,
	832, 1386, 997, 846, 1533, 1419, 1049, 1417, 904, 1410,
	215, 29, 994, 719, 1532, 659, 1208, 943, 830, 1015,
	363, 782, 747, 300, 454, 1114, 1013, 100, 1484, 1507,
	1233, 677, 966, 304, 1235, 861, 84, 358, 351, 701,
	129, 566, 730, 1123, 998, 335, 1494, 567, 991, 397,
	1294, 1354, 1180, 402, 15, 1346, 1229, 740, 1446, 1074,
	320, 753, 1463, 1286, 1057, 1059, 220, 853, 1129, 283,
	1554, 1258, 562, 358, 454, 1560, 693, 697, 1618, 130,
	71, 254, 1304, 900, 222, 286, 1329, 1107, 1326, 116,
	1273, 2, 199, 275, 782, 339, 658, 1457, 331, 922,
	609, 140, 677, 1588, 1007, 1567, 422, 607, 337, 401,
	737, 409, 368, 402, 1021, 590, 401, 711, 1410, 1439,
	540, 756, 1153, 739, 1032, 297, 1079, 51, 115, 1122,
	973, 437, 1262, 1362, 98, 342, 1002, 233, 949, 1340,
	346, 1398, 1461, 714, 1513, 843, 1017, 275, 1266, 500,
	75, 167, 1256, 1228, 
};

#define uchar unsigned char

int
def_bodies_hash(const uchar *key)
{
	int i;
	unsigned f0, f1, f2;
	const uchar *kp = key;

	for (i=-46, f0=f1=f2=0; *kp; ++kp) {
		if (*kp < 46 || *kp > 122)
			return -1;
		if (kp-key > 11)
			return -1;
		f0 += T0[i + *kp];
		f1 += T1[i + *kp];
		f2 += T2[i + *kp];
		i += 77;
	}

	if (kp-key < 10)
		return -1;

	f0 %= 1639;
	f1 %= 1639;
	f2 %= 1639;

	if (f1 == f0 && ++f1 >= 1639)
		f1 = 0;
	if (f2 == f0 && ++f2 >= 1639)
		f2 = 0;
	if (f1 == f2) {
		if (++f2 >= 1639)
			f2 = 0;
		if (f2 == f0 && ++f2 >= 1639)
			f2 = 0;
	}

	return g[f0] + g[f1] + g[f2];
}